<%@ page import="entity.User" %><%--
  Created by IntelliJ IDEA.
  User: teacher
  Date: 2022/12/14
  Time: 10:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>主页</title>
</head>
<body>
<!--
    当用户未登录时,显示登录与注册的链接
    判断session中是否存在user
-->
<%
    User user = (User) session.getAttribute("user");
    if(null == user){
%>
<a href="<%=request.getContextPath()%>/session/register.jsp">注册</a>
<a href="<%=request.getContextPath()%>/session/login.jsp">登录</a>
<%
    } else{
%>
<!--
    当用户已经登录,显示欢迎与注销
-->
欢迎您:<%=user.getUsername()%>
<a href="<%=request.getContextPath()%>/logout.user">注销</a>
<%
    }
%>
</body>
</html>
